package com.anolesoft.amljmes.fortysix.service.impl;

import com.anolesoft.amljmes.fortysix.dto.MesBzzPtdDto;
import com.anolesoft.amljmes.fortysix.dto.MesBzzPtdmxDto;
import com.anolesoft.amljmes.fortysix.service.info.PtddeleteUpdateService;
import com.anolesoft.amljmes.fortysix.service.mapper.PtddeleteUpdateServiceMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PtddeleteUpdateServiceImpl implements PtddeleteUpdateService{
    @Autowired
    PtddeleteUpdateServiceMapper ptddeleteUpdateServiceMapper;


    @Override
    public int deletePtd(List<String> supportingPlanPks) {
        int count = 0;
        for(String supportingPlanPk : supportingPlanPks) {
            count += ptddeleteUpdateServiceMapper.deletePtd(supportingPlanPk);
        }
        return count;
    }

    @Override
    public int updatePtd(List<MesBzzPtdDto> inFoDtoParam) {
        int count = 0;
        for(MesBzzPtdDto mesBzzPtdDto : inFoDtoParam) {
            count += ptddeleteUpdateServiceMapper.updatePtd(mesBzzPtdDto);
        }
        return count;
    }

    @Override
    public int deletePtdmx(List<String> detailsPks) {
        int count = 0;
        for(String detailsPk : detailsPks) {
            count += ptddeleteUpdateServiceMapper.deletePtdmx(detailsPk);
        }
        return count;
    }

    @Override
    public int updatePtdmx(List<MesBzzPtdmxDto> inFoDtoParam) {
        int count = 0;
        for(MesBzzPtdmxDto mesBzzPtdmxDto : inFoDtoParam) {
            count += ptddeleteUpdateServiceMapper.updatePtdmx(mesBzzPtdmxDto);
        }
        return count;
    }
}
